Imports System.Windows.Forms
Imports dao
 Imports System.Data
Imports DTO
Public Class GIAOVIENTHEBus
Inherits AbstractBus
 Public Sub New()
 End Sub
 Public Sub New(ByVal ConnectionString As KetNoiDto)
 ketnoi = ConnectionString
 End Sub
 #Region "Xử Lý" 
 Public Sub Them(ByVal Dto As GIAOVIENTHEDto)
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.Them(Dto)
 End Sub
 Public Sub Xoa( ByVal IDGIAOVIENTHE As System.Int32)
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.xoa(IDGIAOVIENTHE)
 End Sub
 Public Sub sua(ByVal Dto As GIAOVIENTHEDto)
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.sua(Dto)
 End Sub
 #End Region 
 Public Function LayBangTable() As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 dao.laybang()
 Return Dao
 End Function
 Public Function LayBangTableIlist() As IList
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoGIAOVIENTHE As GIAOVIENTHEdto = LayBangDTo(i, Dao) 
 aList.Add(dtoGIAOVIENTHE)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableSQL(ByVal sql As string) As DataTable
 Dim Dao As New  AbstractDao(sql,sql,ketnoi)
 Return Dao
 End Function
 Public Sub suaIDGIAOVIEN( ByVal IDGIAOVIEN as System.Int32, ByVal IDGIAOVIENTHE As System.Int32 )
 Dim dao As New GIAOVIENTHEDao(ketnoi)
 dao.suaIDGIAOVIEN(IDGIAOVIEN,IDGIAOVIENTHE)
 End Sub 
 Public Sub suaIDLOPHOC( ByVal IDLOPHOC as System.Int32, ByVal IDGIAOVIENTHE As System.Int32 )
 Dim dao As New GIAOVIENTHEDao(ketnoi)
 dao.suaIDLOPHOC(IDLOPHOC,IDGIAOVIENTHE)
 End Sub 
 Public Sub suaNGAY( ByVal NGAY as System.DateTime, ByVal IDGIAOVIENTHE As System.Int32 )
 Dim dao As New GIAOVIENTHEDao(ketnoi)
 dao.suaNGAY(NGAY,IDGIAOVIENTHE)
 End Sub 
 Public Sub suaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDGIAOVIENTHE As System.Int32 )
 Dim dao As New GIAOVIENTHEDao(ketnoi)
 dao.suaTRANGTHAI(TRANGTHAI,IDGIAOVIENTHE)
 End Sub 
 Public Sub suaGHICHU( ByVal GHICHU as System.String, ByVal IDGIAOVIENTHE As System.Int32 )
 Dim dao As New GIAOVIENTHEDao(ketnoi)
 dao.suaGHICHU(GHICHU,IDGIAOVIENTHE)
 End Sub 
 Public Function LayBangTable( ByVal IDGIAOVIENTHE As System.Int32) As DataTable
 Dim Dao As New GIAOVIENTHEDao(IDGIAOVIENTHE,ketnoi)
 Return Dao
 End Function
 Public Function LayBangTableIlist( ByVal IDGIAOVIENTHE As System.Int32) As IList
 Dim Dao As New GIAOVIENTHEDao(IDGIAOVIENTHE,ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoGIAOVIENTHE As GIAOVIENTHEdto = LayBangDTo(i, Dao) 
 aList.Add(dtoGIAOVIENTHE)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableTheoIDGIAOVIENTHE (ByVal IDGIAOVIENTHE As System.Int32) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoIDGIAOVIENTHE(IDGIAOVIENTHE)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDGIAOVIENTHE (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoIDGIAOVIENTHE(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDGIAOVIENTHE (ByVal IDGIAOVIENTHE As System.Int32) 
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.XOABangTheoIDGIAOVIENTHE(IDGIAOVIENTHE)
 End sub
 Public Function LayBangTableTheoIDGIAOVIEN (ByVal IDGIAOVIEN As System.Int32) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoIDGIAOVIEN(IDGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDGIAOVIEN (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoIDGIAOVIEN(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDGIAOVIEN (ByVal IDGIAOVIEN As System.Int32) 
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.XOABangTheoIDGIAOVIEN(IDGIAOVIEN)
 End sub
 Public Function LayBangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(IDLOPHOC)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDLOPHOC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) 
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.XOABangTheoIDLOPHOC(IDLOPHOC)
 End sub
 Public Function LayBangTableTheoNGAY (ByVal NGAY As System.DateTime) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoNGAY(NGAY)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAY(ByVal NGAY1 As System.DateTime,ByVal NGAY2 As System.DateTime ) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoNGAY(NGAY1 ,NGAY2)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAY (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoNGAY(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGAY (ByVal NGAY As System.DateTime) 
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.XOABangTheoNGAY(NGAY)
 End sub
 Public Function LayBangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(TRANGTHAI)
 Return Dao
 End Function
 Public Function LayBangTableTheoTRANGTHAI (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) 
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.XOABangTheoTRANGTHAI(TRANGTHAI)
 End sub
 Public Function LayBangTableTheoGHICHU (ByVal GHICHU As System.String) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoGHICHU(GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU_like (ByVal GHICHU As System.String ) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoGHICHU_like (GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangTheoGHICHU(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoGHICHU (ByVal GHICHU As System.String) 
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.XOABangTheoGHICHU(GHICHU)
 End sub
 Public Function LayBangDTo( ByVal IDGIAOVIENTHE As System.Int32) As GIAOVIENTHEdto
 Dim Dao As New GIAOVIENTHEDao(IDGIAOVIENTHE, ketnoi)
 Dim dto As New GIAOVIENTHEdto
 If Dao.Rows.Count<= 0 then Return dto
 Try
 If IsDBNull(Dao.Rows(0)("IDGIAOVIENTHE")) = False Then
 Dto.IDGIAOVIENTHE = Dao.Rows(0)("IDGIAOVIENTHE")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIENTHE.IDGIAOVIENTHE")) = False Then
 Dto.IDGIAOVIENTHE = Dao.Rows(0)("GIAOVIENTHE.IDGIAOVIENTHE")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(0)("IDGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIENTHE.IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(0)("GIAOVIENTHE.IDGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIENTHE.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("GIAOVIENTHE.IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGAY")) = False Then
 Dto.NGAY = Dao.Rows(0)("NGAY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIENTHE.NGAY")) = False Then
 Dto.NGAY = Dao.Rows(0)("GIAOVIENTHE.NGAY")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIENTHE.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("GIAOVIENTHE.TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GHICHU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIENTHE.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GIAOVIENTHE.GHICHU")
 End if
Catch ex As Exception
End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal i As Integer, ByVal dao As DataTable) As GIAOVIENTHEdto
 Dim dto As New GIAOVIENTHEdto
 If Dao.Rows.Count<=0 then Return dto
 Try
 If IsDBNull(Dao.Rows(i)("IDGIAOVIENTHE")) = False Then
 Dto.IDGIAOVIENTHE = Dao.Rows(i)("IDGIAOVIENTHE")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIENTHE.IDGIAOVIENTHE")) = False Then
 Dto.IDGIAOVIENTHE = Dao.Rows(i)("GIAOVIENTHE.IDGIAOVIENTHE")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(i)("IDGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIENTHE.IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(i)("GIAOVIENTHE.IDGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIENTHE.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("GIAOVIENTHE.IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGAY")) = False Then
 Dto.NGAY = Dao.Rows(i)("NGAY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIENTHE.NGAY")) = False Then
 Dto.NGAY = Dao.Rows(i)("GIAOVIENTHE.NGAY")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIENTHE.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("GIAOVIENTHE.TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GHICHU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIENTHE.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GIAOVIENTHE.GHICHU")
 End if
 Catch ex As Exception
 End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal dong As Integer, ByVal dao As DataGridView) As GIAOVIENTHEdto
 Dim dto As New GIAOVIENTHEdto
 If dao.Rows.Count <= 0 Then Return dto
 For cot As Integer = 0 To dao.Columns.Count - 1
 Try
 Dto.HoTro(dao.Columns(cot).DataPropertyName, dao.Item(cot, dong).Value)
 Catch ex As Exception
 End Try
 Next
 Return Dto
 End Function
 Public Function layBangNhieuTable() as Datatable
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.layBangNhieuTable()
 Return Dao
 End Function
 Public Sub Taotable()
 Dim Dao As New GIAOVIENTHEDao(ketnoi)
 Dao.TaoTable()
 End Sub
 End Class

